﻿using M.Entities;
using M.ValueGenerated;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.ComponentModel.DataAnnotations.Schema;


namespace M.EntityConfigurations
{
    public class UserConfiguration : IEntityTypeConfiguration<User>
    {
        public void Configure(EntityTypeBuilder<User> builder)
        {
            // builder.ToTable("User3");

            builder.Property(x => x.Id)
                .HasMaxLength(32)
                .HasComment("主键ID")  // 注释
                // .ValueGeneratedNever()  取消自动生成
                .HasValueGenerator<UserIdGenerator>();
        }
    }
}